package runze.util.security.filter;

import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

import javax.servlet.FilterChain;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;

import org.apache.struts2.dispatcher.filter.StrutsPrepareAndExecuteFilter;

public class UeditorFilter extends StrutsPrepareAndExecuteFilter {
	public void doFilter(ServletRequest req,ServletResponse res,FilterChain chain) throws IOException,ServletException{
		Properties p = new Properties();
		InputStream in = UeditorFilter.class.getResourceAsStream("pic.properties");
		p.load(in);
		String dir = p.getProperty("url");
		HttpServletRequest request =(HttpServletRequest) req;
		String url = request.getRequestURI();
System.out.println(url);		
		if(("/" + dir + "/ueditor/jsp/controller.jsp").equals(url)) {
			chain.doFilter(req, res);
		} else {
			super.doFilter(req, res, chain);
		}
	}
}
